#!/bin/sh

BASEDIR=/usr/share/java/neo4j

export NEO4J_HOME="${NEO4J_HOME:-/var/lib/neo4j}"
export NEO4J_CONF="${NEO4J_CONF:-/etc/neo4j}"

for name in "$BASEDIR"/*.jar ; do
  CLASSPATH=$CLASSPATH:$name
done

SCALADIR=/usr/share/scala/lib/
for name in "$SCALADIR"/*.jar ; do
  CLASSPATH=$CLASSPATH:$name
done

export PATH="/usr/lib/jvm/java-17-openjdk/bin/:$PATH"
exec java \
  -classpath "$CLASSPATH" \
  -Dapp.name="%APP_NAME%" \
  -Dapp.pid="$$" \
  -Dapp.repo="$BASEDIR" \
  -Dapp.home="$BASEDIR" \
  -Dbasedir="$BASEDIR" \
  %CLASS_NAME% \
  "$@"
